
package com.ebupt.migu.globalpopup.enums;
import lombok.Getter;


/**
 * 前置条件类型枚举
 * 前置条件属性（1，设备信息；2，账号信息；3，app信息；4，省份运营；5，渠道标签；6，登录；7，网络环境；8，会员省份；9，达人身份）
 */
@Getter
public enum FropertyEnum {

	FROPERTY_ENUM_ACCOUNT(2, "账号信息", "Account"),
	FROPERTY_ENUM_APP(3, "app信息", "App"),
	FROPERTY_ENUM_CHANNEL(5, "渠道标签", "Channel"),
	FROPERTY_ENUM_DYNAMIC_GROUP(12, "动态人群", "DynamicGroup"),
	FROPERTY_ENUM_EQUIPMENT(1, "设备信息", "Equipment"),
	FROPERTY_ENUM_GRADE(10, "成长等级", "Growth"),
	FROPERTY_ENUM_LOGIN(6, "登录", "Login"),
	FROPERTY_ENUM_MEMBER(8, "会员身份", "Member"),
	FROPERTY_ENUM_NETWORK(7, "网络环境", "Network"),
	FROPERTY_ENUM_OPERATOR(13, "运营商", "Operator"),
	FROPERTY_ENUM_PROVINCE(4, "分省运营", "Province"),
	FROPERTY_ENUM_SUBTYPE(11, "达人身份（subtype）", "Subtype"),
	FROPERTY_ENUM_TYPE(9, "达人身份（type）", "Type");

	final int code;
	final String name;
	final String enname;

	FropertyEnum(int code, String name, String enname) {
		this.code = code;
		this.name = name;
		this.enname = enname;
	}

	public static String getCodeByName(int code) {
		for (FropertyEnum v : values()) {
			if (v.getCode() == code) {
				return v.getName();
			}
		}
		return null;
	}

	public static String getCodeByEnName(int code) {
		for (FropertyEnum v : values()) {
			if (v.getCode() == code) {
				return v.getEnname();
			}
		}
		return null;
	}

	public static Integer getNameByCode(String name) {
		for (FropertyEnum v : values()) {
			if (v.getName().equals(name)) {
				return v.getCode();
			}
		}
		return null;
	}
}
